package com.sunrise.xdoc.entity.operator;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.sunrise.xdoc.entity.AbstractAuditEntity;

@Entity
@Table(name = "op_privilege")
@Inheritance(strategy = InheritanceType.JOINED)
public class Privilege extends AbstractAuditEntity {
	private static final long serialVersionUID = 6748951023283234711L;
	private OperatorProfile profile;
	private Function function;
	private String possibleMode = ""; // "CRUDE"

	@ManyToOne
	@JoinColumn(name = "profile_id")
	@NotNull
	public OperatorProfile getProfile() {
		return profile;
	}

	public void setProfile(OperatorProfile profile) {
		this.profile = profile;
	}

	@ManyToOne
	@JoinColumn(name = "function_id")
	@NotNull
	public Function getFunction() {
		return function;
	}

	public void setFunction(Function function) {
		this.function = function;
	}

	@Column(name = "possible_mode")
	@Length(max = 5)
	public String getPossibleMode() {
		return possibleMode;
	}

	public void setPossibleMode(String possibleMode) {
		this.possibleMode = possibleMode;
	}
}
